package com.tcfvic.client.panels;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.VerticalSplitPanel;
import com.tcfvic.client.IndustryDetailsListService;
import com.tcfvic.client.IndustryDetailsListServiceAsync;
import com.tcfvic.client.panels.widgets.IndustryDetailsInputWidget;
import com.tcfvic.client.panels.widgets.IndustryDetailsListWidget;

public class IndustryDetailsForm {

	/**
	 * Create a remote service proxy to talk to the server-side CompanyDetails
	 * service.
	 */
	private final IndustryDetailsListServiceAsync industryListService = GWT
			.create(IndustryDetailsListService.class);
	private VerticalSplitPanel vSplit = new VerticalSplitPanel();

	public IndustryDetailsForm(boolean editing) {
		// Create a Vertical Split Panel
		vSplit = new VerticalSplitPanel();
		vSplit.ensureDebugId("cwVerticalSplitPanel");
		vSplit.setSize("900px", "800px");
		vSplit.setSplitPosition("1%");

		IndustryDetailsInputWidget industryDetails = new IndustryDetailsInputWidget();
		IndustryDetailsListWidget industryDetailsList = null;
		if (editing) {
			industryDetailsList = new IndustryDetailsListWidget(
					industryListService, industryDetails);
			vSplit.setTopWidget(industryDetailsList);
			vSplit.setSplitPosition("40%");
		}
		industryDetails.addIndustryDetailsList(industryDetailsList);
		vSplit.setBottomWidget(industryDetails);

	}

	public VerticalSplitPanel getvSplit() {
		return vSplit;
	}
}
